<title>巡检计划</title>

<link href='../../../src/fullcalendar/core/main.css' rel='stylesheet' />
<link href='../../../src/fullcalendar/daygrid/main.css' rel='stylesheet' />
<link href="../../../src/fullcalendar/timegrid/main.css">
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

<script src="../../../src/js/jquery-1.9.1.min.js"></script>
<script src="../../../src/js/jquery-ui-1.10.2.custom.min.js"></script>
<script src="../../../src/js/moment.min.js"></script>
<script src="../../../src/js/jquery-ui.min.js"></script>
<script src='../../../src/fullcalendar/core/main.js'></script>
<script src='../../../src/fullcalendar/interaction/main.js'></script>
<script src='../../../src/fullcalendar/daygrid/main.js'></script>
<script src="../../../src/fullcalendar/timegrid/main.js"></script>
<script src="../../../src/fullcalendar/core/locales-all.js"></script>
<script src='../../../src/fullcalendar/bootstrap/main.js'></script>

<link rel="stylesheet" href="../../../src/style/css/home/edit-alert.css">   
<div>
    
    <div class="layui-upload">
        <button type="button" class="layui-btn layui-btn-normal" id="addexport">选择多文件</button> 
        <div class="layui-upload-list" id="demoList">
        </div>
        <button type="button" class="layui-btn" id="testListAction">开始上传</button>
    </div> 
    <div id="Tbtns">测试</div>
    <div id='test'></div>
    <div id='calendar'></div>
</div>
<script>
        layui.use(['laydate','jquery','layer','upload','api','table'], function() {
            var laydate = layui.laydate;
            var $=layui.jquery
            var layer=layui.layer
            var upload=layui.upload,
                admin = layui.admin,
                view = layui.view,
                api = layui.api,
                table = layui.table,
                setter = layui.setter;
                var filesArr=[];
                var formtitle = $('.formtitle')  
                var demoListView = $('#demoList') 
                
                var uploadInst = upload.render({
                    elem: '#addexport'
                    ,url: api.host+'/do/upload.json',
                    headers:{  
                        'token': layui.sessionData(setter.tableName).token 
                    }
                    // ,auto: false
                    ,accept: 'file' 
                    ,bindAction: '#testListAction', 
                    choose: function(obj){    
                        // var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                        //读取本地文件
                        obj.preview(function(index, file, result){ 
                            var tr=$(['<li id="upload-'+ index +'">','<span>'+ file.name +'</span  class="layui-btn layui-btn-xs layui-btn-danger demo-delete"><p>X</p> <button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button></li>'].join(''));   

                            var trs = $(['<tr id="upload-'+ index +'">'
                                ,'<td>'+ file.name +'</td>' 
                                ,'<td>' 
                                    ,'<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                                ,'</td>'
                                ,'</tr>'].join(''));  
                                tr.find('.demo-delete').on('click', function(){
                                tr.remove();
                                });
                                demoListView.append(tr);
                        }); 
                    }
                    ,done: function(res){   
                            filesArr.push(res.data)  
                    },
                    error:function(){
                    }
                });
              
            $('#Tbtns').on('click', function() {
                layer.open({
                        type: 2,
                        title: false,
                        area: ['366px', '454px'],
                        fixed: true,
                        shadeClose: true,
                        closeBtn: 0,
                        content: ['../../src/views/home/my_home/one.html', 'no'],
                        yes: function(index, layero){
                            //do something
                            layer.close(index); //如果设定了yes回调，需进行手工关闭
                        },end: function(index, layero){
                            //do something
                            layer.close(index); //如果设定了yes回调，需进行手工关闭
                        },
                    });
            }) 
            $(function() { 
                var date = new Date();
                var d = date.getDate();
                var m = date.getMonth();
                var y = date.getFullYear(); 
            })
            })
            $('.English').on('click', function () {
            })

        var calendarEl = document.getElementById('calendar');
        var calendar = new FullCalendar.Calendar(calendarEl, {
            // plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
            plugins: ['dayGrid', 'timeGrid', 'list'],
            buttonText: {
                today: "今天",
                month: "月",
                week: "周",
                day: "日"
            },
            // defaultDate: '2019-08-12',
            locale: "zh-cn",
            axisFormat: 'h(:mm)tt',
            allDayDefault: false,
            defaultDate: '2019-08-12',
            navLinks: true, // can click day/week names to navigate views
            editable: true,
            eventLimit: true, // allow "more" link when too many events
            selectable: false,
            eventLimit: 4, //事件个数
            allDaySlot: true, //是否显示allDay
            allDayText: "全天", //自定义全天视图的名称
            slotDuration: "01:00:00", //一格时间槽代表多长时间，默认00:30:00（30分钟）
            slotLabelFormat: "H(:mm)a", //日期视图左边那一列显示的每一格日期时间格式
            slotLabelInterval: "02:00:00", //日期视图左边那一列多长间隔显示一条日期文字(默认跟着slotDuration走的，可自定义)
            snapDuration: "05:00:00",
            eventClick: this.eventClick, //点击事件
            dayClick: this.dayClick, //点击日程表上面某一天
            events: [{
                title: 'All Day Event',
                start: '2019-08-01'
            }, {
                title: 'Long Event',
                start: '2019-08-07',
                end: '2019-08-10'
            }, {
                groupId: 999,
                title: 'Repeating Event',
                start: '2019-08-09T16:00:00'
            }, {
                groupId: 999,
                title: 'Repeating Event',
                start: '2019-08-16T16:00:00'
            }, {
                title: 'Conference',
                start: '2019-08-11',
                end: '2019-08-13'
            }, {
                title: 'Meeting',
                start: '2019-08-12T10:30:00',
                end: '2019-08-12T12:30:00'
            }, {
                title: 'Lunch',
                start: '2019-08-12T12:00:00'
            }, {
                title: 'Meeting',
                start: '2019-08-12T14:30:00'
            }, {
                title: 'Happy Hour',
                start: '2019-08-12T17:30:00'
            }, {
                title: 'Dinner',
                start: '2019-08-12T20:00:00'
            }, {
                title: 'Birthday Party',
                start: '2019-08-13T07:00:00'
            }, {
                title: 'Click for Google',
                url: 'http://baidu.com/',
                start: '2019-08-28'
            }],
            // });
            customButtons: {

                myCustomButton: {
                    text: '自定义按钮',
                    click: function() {
                        alert('点击了自定义按钮!');
                    }
                }
            },
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'dayGridMonth,dayGridWeek,dayGridDay',
            },


        });
        calendar.render();
</script>